package com.eddie.memento.game;

/**
 * @author Eddie
 * @date 2022/08/04 12:23
 **/
public class Client {
    public static void main(String[] args) {
        //创建游戏角色
        GameRole gameRole = new GameRole();
        gameRole.setVit(100);
        gameRole.setDef(100);

        System.out.println("和BOSS 大战前的状态");
        gameRole.display();

        //把当前状态保存到Caretaker
        Caretaker caretaker = new Caretaker();
        caretaker.setMemento(gameRole.createMemento());

        System.out.println("和BOSS开始大战");
        gameRole.setDef(30);
        gameRole.setVit(30);
        gameRole.display();

        System.out.println("恢复大战前的状态");
        gameRole.recoverGameRoleFromMemento(caretaker.getMemento());
        gameRole.display();
    }
}
